package com.example.a10928.weifriend.http.api;
import com.example.a10928.weifriend.http.api.base.ActiveDetailBean;
import com.example.a10928.weifriend.http.api.base.ActivityShopBean;
import com.example.a10928.weifriend.http.api.base.AdverCenterBean;
import com.example.a10928.weifriend.http.api.base.AdverTypeBean;
import com.example.a10928.weifriend.http.api.base.AllBannerBean;
import com.example.a10928.weifriend.http.api.base.AllDetatlBean;
import com.example.a10928.weifriend.http.api.base.BankBean;
import com.example.a10928.weifriend.http.api.base.BankInfoBean;
import com.example.a10928.weifriend.http.api.base.CarMallBean;
import com.example.a10928.weifriend.http.api.base.ClassBean;
import com.example.a10928.weifriend.http.api.base.CustomerServiceBean;
import com.example.a10928.weifriend.http.api.base.DownLoadBean;
import com.example.a10928.weifriend.http.api.base.EditABean;
import com.example.a10928.weifriend.http.api.base.GetAdverBean;
import com.example.a10928.weifriend.http.api.base.InfoBean;
import com.example.a10928.weifriend.http.api.base.LoginBean;
import com.example.a10928.weifriend.http.api.base.MemberBean;
import com.example.a10928.weifriend.http.api.base.MemberDetailBean;
import com.example.a10928.weifriend.http.api.base.MyAdertBean;
import com.example.a10928.weifriend.http.api.base.MyAdverBean;
import com.example.a10928.weifriend.http.api.base.MyBankBean;
import com.example.a10928.weifriend.http.api.base.NewNoticeBean;
import com.example.a10928.weifriend.http.api.base.NewvipDataBean;
import com.example.a10928.weifriend.http.api.base.NoticeDetatlBean;
import com.example.a10928.weifriend.http.api.base.PayBean;
import com.example.a10928.weifriend.http.api.base.ProvinceBean;
import com.example.a10928.weifriend.http.api.base.QrCodeBean;
import com.example.a10928.weifriend.http.api.base.RankBean;
import com.example.a10928.weifriend.http.api.base.RegisterBean;
import com.example.a10928.weifriend.http.api.base.ReleaseAderBean;
import com.example.a10928.weifriend.http.api.base.SubmitTaskBean;
import com.example.a10928.weifriend.http.api.base.TaskDetailBean;
import com.example.a10928.weifriend.http.api.base.TaskDetailsBean;
import com.example.a10928.weifriend.http.api.base.UpdateVIPBean;
import com.example.a10928.weifriend.http.api.base.UpdateVIPTwoBean;
import com.example.a10928.weifriend.http.api.base.UpvipPriceBean;
import com.example.a10928.weifriend.http.api.base.UserMessagBean;
import com.example.a10928.weifriend.http.api.base.UserMsgBean;
import com.example.a10928.weifriend.http.api.base.VipSortBean;
import com.example.a10928.weifriend.http.api.base.WalletBean;
import com.example.a10928.weifriend.http.api.base.WalletFlowBean;
import com.example.a10928.weifriend.http.api.base.WeekRankBean;
import com.example.a10928.weifriend.http.api.base.YesterdayRankBean;
import com.example.a10928.weifriend.http.configuration.InsertSignInterceptor;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;

public interface BpService {

    /**
     * 标记同步版的BpService实例，不自动切换线程，需要手动切; 对应{@link } ()}
     */
    String SYNC = "sync";
    /**
     * 标记异步版的BpService实例,执行在子线程,返回结果在主线程
     */
    String ASYNC = "async";
    /**
     * 标记一个BpService实例,执行在io线程,返回结果在io线程
     */
    String IO = "io";

    //登录
/*    @FormUrlEncoded
    @POST(Api.API_GET_COIN_AREA)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> login(
            @Field("phone") String phone,
            @Field("password") String password
    );*/
/*

    // 检测手机号是否注册
    @GET(Api.API_GET_COIN_AREA)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper> checkRegister(
            @Query("phone") String phone
    );
*/

    // 检测手机号是否注册
    @GET(Api.API_CHECK_PHONE_REGISTER)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> checkPhoneRegister(
            @Query("phone") String phone
    );

    @GET(Api.API_SEND_CODE_SMS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> sendCodeSMS(
            @Query("phone") String phone
    );

    @GET(Api.API_CHECK_CODE)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> checkCode(
            @Query("phone") String phone,
            @Query("code") String code
    );


    @FormUrlEncoded
    @POST(Api.API_SAVE_USER_MSG)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<RegisterBean>> saveUserMsg(
            @Field("phone") String phone,
            @Field("code") String code,
            @Field("password") String password,
            @Field("re_password") String re_password,
            @Field("invite_code") String invite_code
    );

    @FormUrlEncoded
    @POST(Api.API_LOGIN)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<LoginBean>> login(
            @Field("phone") String phone,
            @Field("password") String password
    );

    @FormUrlEncoded
    @POST(Api.API_RETRIEVE_PASSWORD)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> retrievePassword(
            @Field("phone") String phone,
            @Field("code") String code,
            @Field("password") String password,
            @Field("re_password") String re_password
    );

    @GET(Api.API_LOGOUT)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> logout(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_USER_HOME_MSG)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<UserMsgBean>> getUserHomeMsg(
            @Query("user_id") String user_id
    );

    @FormUrlEncoded
    @POST(Api.API_BIND_PAY_ACCOUNT)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> bindPayAccount(
            @Field("user_id") String user_id,
            @Field("account") String account,
            @Field("real_name") String real_name
    );

    @FormUrlEncoded
    @POST(Api.API_UPGRADE_VIP)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> buyVip(
            @Field("user_id") String user_id,
            @Field("pay_type") int payType,
            @Field("pay_money") double payMoney,
            @Field("user_type_id") String user_type_id
    );

    @FormUrlEncoded
    @POST(Api.API_UPGRADE_VIP)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<UpdateVIPTwoBean> buyVipTwo(
            @Field("user_id") String user_id,
            @Field("pay_type") int payType,
            @Field("pay_money") double payMoney,
            @Field("user_type_id") String user_type_id
    );

    @Multipart
    @POST(Api.API_RELERASE_ADVER)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<ReleaseAderBean>> releraseAdverTwo(
            @Part("ad_title") RequestBody title,
            @Part("ad_content") RequestBody content,
            @Part("ad_unit_price") RequestBody price,
            @Part("ad_number") RequestBody number,
            @Part("pay_type") RequestBody pay_type,
            @Part("user_id") RequestBody user_id,
            @Part() List<MultipartBody.Part> parts
    );

    @Multipart
    @POST(Api.API_RELERASE_ADVER)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> releraseAdver(
            @Part("ad_title") RequestBody title,
            @Part("ad_content") RequestBody content,
            @Part("ad_unit_price") RequestBody price,
            @Part("ad_number") RequestBody number,
            @Part("pay_type") RequestBody pay_type,
            @Part("user_id") RequestBody user_id,
            @Part() List<MultipartBody.Part> parts
    );


    @GET(Api.API_GET_USER_PAY_ACCOUNTS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<PayBean>> getUserPayAccounts(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_USER_WALLET)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<WalletBean>> getUserWallet(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_MONEY_FLOW)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<WalletFlowBean>> getMoneyFlow(
            @Query("user_id") String user_id
    );

    @FormUrlEncoded
    @POST(Api.API_WITH_DRAW)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> withdraw(
            @Field("user_id") String user_id,
            @Field("amount") String amount,
            @Field("account_type") String account_type
    );

    @GET(Api.API_GET_PROVINCES)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<ProvinceBean>> getProvinces(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_CITIES)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<CitiesBean>> getCities(
            @Query("user_id") String user_id,
            @Query("provinceid") String provinceid
    );

    @Multipart
    @POST(Api.API_CHANGE_USER_MSG)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<InfoBean>> changeUserMsg(
            @Part("user_id") RequestBody user_id,
            @Part("user_name") RequestBody user_name,
            @Part("real_name") RequestBody real_name,
            @Part("city_id") RequestBody city_id,
            @Part("address_detail") RequestBody address_detail,
            @Part() MultipartBody.Part head_img
    );

    @Multipart
    @POST(Api.API_SUBMIT_TASK)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<SubmitTaskBean>> submitTask(
            @Part("user_id") RequestBody user_id,
            @Part("id") RequestBody id,
            @Part() MultipartBody.Part proof_img
    );

    @GET(Api.API_GET_SONS_NUM)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<ClassBean>> getSonsNum(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_CLASS1_NUM)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<MemberBean>> getClass1Num(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_CLASSL2_NUM)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<MemberBean>> getClass2Num(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_CLASS1_DETAILS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<MemberDetailBean>> getClass1Details(
            @Query("user_id") String user_id,
            @Query("type") String type
    );

    @GET(Api.API_GET_USER_MSG)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<UserMessagBean>> getUserMsg(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_CLASS2_DETAILS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<MemberDetailBean>> getClass2Details(
            @Query("user_id") String user_id,
            @Query("type") String type
    );

    @GET(Api.API_GET_YESTERDAY_RANKING)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<YesterdayRankBean>> get_yesterday_ranking(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_TODAY_RANKING)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<RankBean>> get_today_ranking(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_WEEK_DETAILS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<WeekRankBean>> get_week_ranking(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_MY_ADERTSEMENT)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<MyAdertBean>> getMyAdvertisement(
            @Query("user_id") String user_id,
            @Query("type") String type
    );

    @GET(Api.API_EXTEND_QR)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<QrCodeBean>> getExtendQr(
            @Query("user_id") String user_id
    );

    @GET(Api.API_CUSTOMER_SERVICE)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<CustomerServiceBean>> getCustomerService();

    @GET(Api.API_CAR_MALL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<CarMallBean>> getCarMall();

    @GET(Api.API_ADVER_CEMTER)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapperList<AdverCenterBean>> getAdverCenter(
            @Query("user_id") String user_id,
            @Query("adver_type") int type
    );

    @GET(Api.API_ADVER_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<TaskDetailsBean>> getAdverDetail(
            @Query("user_id") String user_id,
            @Query("ad_id") int ad_id

    );

    @GET(Api.API_ADVER_TYPE)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapperList<AdverTypeBean>> getAdverType(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_ADVER)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<GetAdverBean>> getAdver(
            @Query("user_id") String user_id,
            @Query("ad_id") int ad_id
    );

    @GET(Api.API_GET_MY_TASK)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapperList<MyAdverBean>> getMyTask(
            @Query("user_id") String user_id,
            @Query("is_finish") int status
    );

    @GET(Api.API_TASK_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<TaskDetailBean>> getTaskDetail(
            @Query("user_id") String user_id,
            @Query("id") int ad_id
    );

    @GET(Api.API_NOTICE_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<NoticeDetatlBean>> getNoticeDetatl();

    @GET(Api.API_ALL_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapperList<AllDetatlBean>> getAllDetatl();

    @GET(Api.API_ALL_BANNER)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapperList<AllBannerBean>> getAllBanner(
            @Query("banner_pos") String banner_pos
    );

    @FormUrlEncoded
    @POST(Api.API_UPDATE_BANKCARD)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<BankBean>> updateBankCard(
            @Field("user_id") String user_id,
            @Field("verify_name") String verify_name,
            @Field("verify_card_no") String verify_card_no,
            @Field("bank_id") String bank_id,
            @Field("id_card_no") String id_card_no,
            @Field("card_phone") String card_phone,
            @Field("bank_name") String bank_name,
            @Field("verify_id") String verify_id
    );

    @FormUrlEncoded
    @POST(Api.API_CREATE_BANKCARD)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<BankBean>> createBankCard(
            @Field("user_id") String user_id,
            @Field("verify_name") String verify_name,
            @Field("verify_card_no") String verify_card_no,
            @Field("bank_id") String bank_id,
            @Field("id_card_no") String id_card_no,
            @Field("card_phone") String card_phone,
            @Field("bank_name") String bank_name
    );


    @GET(Api.API_GET_BANKLIST)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<BankInfoBean>> getBankList(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_USER_BANKCARD)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<MyBankBean>> getUserBankCard(
            @Query("user_id") String user_id

    );

    @GET(Api.API_NEW_NOTICE)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<NewNoticeBean>> getNewNotice();

    @GET(Api.API_BANNER_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<NewNoticeBean>> getBannerDetail(
            @Query("banner_id") String banner_id
    );

    @GET(Api.API_UPVIP_PRICE)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<UpvipPriceBean>> getUpvipPrice(
            @Query("user_id") String banner_id
    );

    @GET(Api.API_NEWVIP_DATA)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapperList<NewvipDataBean>> getNewvipData(
            @Query("user_id") String banner_id
    );


    @FormUrlEncoded
    @POST(Api.API_UPDATE_PASSWORD)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> updatePassword(
            @Field("user_id") String user_id,
            @Field("old_password") String old_password,
            @Field("new_password") String new_password
    );


    //检查Android是否更新
    @GET(Api.API_GET_ANDROID)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<DownLoadBean>> getAndroid(
            @Query("version") int version
    );


    @FormUrlEncoded
    @POST(Api.API_UPDATE_ALIPAY_ACCOUNT)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<EditABean>> updateAlipayAccount(
            @Field("user_id") String user_id,
            @Field("account") String account,
            @Field("real_name") String real_name
    );


    @GET(Api.API_GET_SHOP_ACTIVITY)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<ActivityShopBean> get_shop_activity(
            @Query("user_id") String user_id,
            @Query("token") String token,
            @Query("is_end") String is_end
    );

    @GET(Api.API_GET_MY_ACTIVITY)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<ActivityShopBean> get_my_activity(
            @Query("user_id") String user_id,
            @Query("token") String token
    );


    @FormUrlEncoded
    @POST(Api.API_TAKE_ACTIVITY)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> take_activity(
            @Field("user_id") String user_id,
            @Field("token") String token,
            @Field("shop_id") int shop_id,
            @Field("pay_type") String pay_type,
            @Field("shop_num") String shop_num
    );


    @GET(Api.API_GET_MY_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<ActiveDetailBean>> get_my_detail(
            @Query("user_id") String user_id,
            @Query("token") String token,
            @Query("shop_id") String shop_id
    );

    @GET(Api.API_GET_SHOP_DETAIL)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<ActiveDetailBean>> get_shop_detail(
            @Query("shop_id") String shop_id
    );

    @GET(Api.API_GET_EVERYDAY_BONUS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<ActiveDetailBean>> get_everyday_bonus(
            @Query("user_id") String user_id
    );

    @GET(Api.API_GET_VIP_DATA)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<VipSortBean> get_vip_data();

    @GET(Api.API_CHECK_EVERYDAY_BONUS)
    @Headers(InsertSignInterceptor.HEADER)
    Observable<RowsWrapper<String>> check_everyday_bonus(
            @Query("user_id") String user_id,
            @Query("token") String token
    );

}




